<?php
class Country{
	static function get($id=-1,$name="",$where=""){
		$sql = "select * from `country`";
		if($where!=""){
			$sql.=" where ".$where;
		}else if($name!=""){
			$sql.=" where `name`='".$name."'";
		}else if($id!=-1){
			$sql.=" where `id`='".$id."'";
		}
		return DB::query($sql);
	}
	static function getSelect($id=-1){
		$select 	= "<select style='width:185px' id='country' name='person[country]'>";
		$countries	= self::get();
		foreach ($countries as $country) {
			$select.="<option value='".$country['id']."'".($id==$country['id']?" selected='selected'":"").">".$country['name']."</option>";
		}
		return $select."</select>";
	}
}
?>